package com.ming_za.odupdaterserver.core.sqlite.domain;

import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import com.ming_za.odupdaterserver.core.service.res.obj.MainUpdateItem;
import lombok.Data;

/**
 * 
 * @TableName main_version
 */
@Data
public class MainVersion implements Serializable {
    /**
     * 版本号，二进制位存储,支持0.0.0.0~127.127.127.127，主版本号.子版本号.修订版本号.构建版本号
     * <pre>
     *     格式:
     *      byte[0] = 主版本号
     *      byte[1] = 子版本号
     *      byte[2] = 修订版本号
     *      byte[3] = 构建版本号
     *     一般只显示前三位
     * </pre>
     */
    private Integer version;

    private List<Long> res;

    /**
     * 
     */
    private Date time;

    /**
     * 
     */
    private boolean published;

    @Serial
    private static final long serialVersionUID = 1L;

    public MainVersion(Integer version, List<Long> res, Date time, boolean published) {
        this.version = version;
        this.res = res;
        this.time = time;
        this.published = published;
    }

    public MainVersion() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MainVersion that = (MainVersion) o;
        return published == that.published && Objects.equals(version, that.version) && Objects.equals(res, that.res) && Objects.equals(time, that.time);
    }

    @Override
    public int hashCode() {
        return Objects.hash(version, res, time, published);
    }
}